/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dabarobjects.mobile.database.types;

import com.dabarobjects.mobile.utils.madex.MadexEncoder;

/**
 *
 * @author DabarObjects Solutions Limited (www.dabarobjects.com)
 */
public class StringObjectNotationParser extends AbstractMadexObjectNotationParser {

    public String getObjectTypeKey() {
        return "st";
    }

    public Object parseObject(String dump) {
        return MadexEncoder.decode(dump);
    }

    public String notateObject(Object obj) {
        if(obj == null || obj.toString().trim().equalsIgnoreCase(""))
            return "{}";

        return "{".concat(MadexEncoder.encode(obj.toString())).concat("}");
    }

}
